/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.prerecieve.entity;

import com.jeesite.modules.base.entity.customer.Customer;
import com.jeesite.modules.order.entity.serviceorder.ServiceOrder;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.util.Date;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.List;
import com.jeesite.common.collect.ListUtils;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

/**
 * 预收款Entity
 * @author wsm
 * @version 2021-03-22
 */
@Table(name="t_advances_received", alias="a", columns={
		@Column(name="advances_received_id", attrName="advancesReceivedId", label="预收款ID", isPK=true),
		@Column(name="advances_received_code", attrName="advancesReceivedCode", label="编号", queryType=QueryType.LIKE),
		@Column(name="customer_id", attrName="customerId", label="客户"),
		@Column(name="date", attrName="date", label="日期"),
		@Column(name="status1", attrName="status1", label="状态"),
		@Column(name="bill_status", attrName="billStatus", label="审批状态"),
		@Column(name="service_order_id", attrName="serviceOrderId", label="服务订单"),
		@Column(name="received_name", attrName="receivedName", label="收款名字", queryType=QueryType.LIKE),
		@Column(name="currency", attrName="currency", label="币种"),
		@Column(name="advances_received_balance", attrName="advancesReceivedBalance", label="预收款余额", isQuery=false),
		@Column(name="estimated_received_amount", attrName="estimatedReceivedAmount", label="预计收款合计", isQuery=false),
		@Column(name="actual_received_amount", attrName="actualReceivedAmount", label="实际收款合计", isQuery=false),
		@Column(name="create_by", attrName="createBy", label="创建者", isUpdate=false),
		@Column(name="create_date", attrName="createDate", label="创建时间", isUpdate=false),
		@Column(name="update_by", attrName="updateBy", label="更新者", isQuery=false),
		@Column(name="update_date", attrName="updateDate", label="更新时间", isQuery=false),
		@Column(name="remarks", attrName="remarks", label="备注信息", isQuery=false),
		@Column(name="parent_bill_type", attrName="parentBillType", label="前置单据类型"),
		@Column(name="parent_bill_code", attrName="parentBillCode", label="前置单据编号"),
		@Column(name="row_number", attrName="rowNumber", label="融资服务订单用的行号"),
	},joinTable = {
		@JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = Customer.class, attrName = "customer", alias = "b",
				on = "b.customer_id = a.customer_id", columns = {
				@Column(name = "customer_id", label = "客户编号", isPK = true),
				@Column(name = "customer_name", label = "客户名称"),
		}),
		@JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = ServiceOrder.class, attrName = "serviceOrder", alias = "c",
				on = "c.service_order_id = a.service_order_id", columns = {
				@Column(name = "service_order_id", label = "服务订单id", isPK = true),
				@Column(name = "service_order_code", label = "服务订单编号"),
		})
}, orderBy="a.update_date DESC"
)
public class TadvancesReceived extends DataEntity<TadvancesReceived> {

	private static final long serialVersionUID = 1L;
	private String advancesReceivedId;		// 预收款ID
	private String advancesReceivedCode;		// 编号
	private String customerId;		// 客户
	private Date date;		// 日期
	private String status1;		// 状态
	private String serviceOrderId;		// 服务订单
	private String receivedName;		// 收款名字
	private String currency;		// 币种
	private Double advancesReceivedBalance;		// 预收款余额
	private Double estimatedReceivedAmount;		// 预计收款合计
	private Double actualReceivedAmount;// 实际收款合计
	private ServiceOrder serviceOrder;
	private Customer customer;
	private String billStatus;//审批状态
	private String parentBillType;//前置单据类型
	private String parentBillCode;//前置单据编号
	private String parentBillCode1;//前置单据编号
	private Long rowNumber;//融资服务订单生成该订单时用的，不用不要管。
	private List<TadvancesReceivedEstimated> tadvancesReceivedEstimatedList = ListUtils.newArrayList();		// 子表列表
	private List<TadvancesReceivedActual> tadvancesReceivedActualList = ListUtils.newArrayList();		// 子表列表

	public Long getRowNumber() {
		return rowNumber;
	}

	public void setRowNumber(Long rowNumber) {
		this.rowNumber = rowNumber;
	}

	public String getParentBillCode1() {
		return parentBillCode1;
	}

	public void setParentBillCode1(String parentBillCode1) {
		this.parentBillCode1 = parentBillCode1;
	}

	public String getParentBillType() {
		return parentBillType;
	}

	public void setParentBillType(String parentBillType) {
		this.parentBillType = parentBillType;
	}

	public String getParentBillCode() {
		return parentBillCode;
	}

	public void setParentBillCode(String parentBillCode) {
		this.parentBillCode = parentBillCode;
	}

	public String getBillStatus() {
		return billStatus;
	}

	public void setBillStatus(String billStatus) {
		this.billStatus = billStatus;
	}

	public ServiceOrder getServiceOrder() {
		return serviceOrder;
	}

	public void setServiceOrder(ServiceOrder serviceOrder) {
		this.serviceOrder = serviceOrder;
	}

	public TadvancesReceived() {
		this(null);
	}

	public TadvancesReceived(String id){
		super(id);
	}

	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public String getAdvancesReceivedId() {
		return advancesReceivedId;
	}

	public void setAdvancesReceivedId(String advancesReceivedId) {
		this.advancesReceivedId = advancesReceivedId;
	}

	@Length(min=0, max=100, message="编号长度不能超过 100 个字符")
	public String getAdvancesReceivedCode() {
		return advancesReceivedCode;
	}

	public void setAdvancesReceivedCode(String advancesReceivedCode) {
		this.advancesReceivedCode = advancesReceivedCode;
	}

	@NotBlank(message="客户不能为空")
	@Length(min=0, max=64, message="客户长度不能超过 64 个字符")
	public String getCustomerId() {
		return customerId;
	}

	public void setCustomerId(String customerId) {
		this.customerId = customerId;
	}

	@JsonFormat(pattern = "yyyy-MM-dd")
	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	@Length(min=0, max=1, message="状态长度不能超过 1 个字符")
	public String getStatus1() {
		return status1;
	}

	public void setStatus1(String status1) {
		this.status1 = status1;
	}

	@NotBlank(message="服务订单不能为空")
	@Length(min=0, max=64, message="服务订单长度不能超过 64 个字符")
	public String getServiceOrderId() {
		return serviceOrderId;
	}

	public void setServiceOrderId(String serviceOrderId) {
		this.serviceOrderId = serviceOrderId;
	}

	@Length(min=0, max=100, message="收款名字长度不能超过 100 个字符")
	public String getReceivedName() {
		return receivedName;
	}

	public void setReceivedName(String receivedName) {
		this.receivedName = receivedName;
	}

	@NotBlank(message="币种不能为空")
	@Length(min=0, max=2, message="币种长度不能超过 2 个字符")
	public String getCurrency() {
		return currency;
	}

	public void setCurrency(String currency) {
		this.currency = currency;
	}

	public Double getAdvancesReceivedBalance() {
		return advancesReceivedBalance;
	}

	public void setAdvancesReceivedBalance(Double advancesReceivedBalance) {
		this.advancesReceivedBalance = advancesReceivedBalance;
	}

	public Double getEstimatedReceivedAmount() {
		return estimatedReceivedAmount;
	}

	public void setEstimatedReceivedAmount(Double estimatedReceivedAmount) {
		this.estimatedReceivedAmount = estimatedReceivedAmount;
	}

	public Double getActualReceivedAmount() {
		return actualReceivedAmount;
	}

	public void setActualReceivedAmount(Double actualReceivedAmount) {
		this.actualReceivedAmount = actualReceivedAmount;
	}

	public Date getDate_gte() {
		return sqlMap.getWhere().getValue("date", QueryType.GTE);
	}

	public void setDate_gte(Date date) {
		sqlMap.getWhere().and("date", QueryType.GTE, date);
	}

	public Date getDate_lte() {
		return sqlMap.getWhere().getValue("date", QueryType.LTE);
	}

	public void setDate_lte(Date date) {
		sqlMap.getWhere().and("date", QueryType.LTE, date);
	}

	public Date getCreateDate_gte() {
		return sqlMap.getWhere().getValue("create_date", QueryType.GTE);
	}

	public void setCreateDate_gte(Date createDate) {
		sqlMap.getWhere().and("create_date", QueryType.GTE, createDate);
	}

	public Date getCreateDate_lte() {
		return sqlMap.getWhere().getValue("create_date", QueryType.LTE);
	}

	public void setCreateDate_lte(Date createDate) {
		sqlMap.getWhere().and("create_date", QueryType.LTE, createDate);
	}

	public List<TadvancesReceivedEstimated> getTadvancesReceivedEstimatedList() {
		return tadvancesReceivedEstimatedList;
	}

	public void setTadvancesReceivedEstimatedList(List<TadvancesReceivedEstimated> tadvancesReceivedEstimatedList) {
		this.tadvancesReceivedEstimatedList = tadvancesReceivedEstimatedList;
	}

	public List<TadvancesReceivedActual> getTadvancesReceivedActualList() {
		return tadvancesReceivedActualList;
	}

	public void setTadvancesReceivedActualList(List<TadvancesReceivedActual> tadvancesReceivedActualList) {
		this.tadvancesReceivedActualList = tadvancesReceivedActualList;
	}

}
